﻿<Window x:Class="Brjnk.GpxExplorer.UI.BitmapExportPaperWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:l="clr-namespace:Brjnk.GpxExplorer.Localization"
        xmlns:my1="clr-namespace:Brjnk.GpxExplorer.UI"
        Title="BitmapExportPaperWindow"
        MinWidth="300"
        SizeToContent="WidthAndHeight">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <RadioButton Content="{l:Loc bitmapExportActualSize}"
                     GroupName="radioButton"
                     IsChecked="{Binding UseActualSize}" />
        <RadioButton Name="customSize"
                     Grid.Row="1"
                     Content="{l:Loc bitmapExportCustom}"
                     GroupName="radioButton" />
        <my1:PaperSizePicker x:Name="paperPicker"
                             Grid.Row="2"
                             Margin="15 0 0 0"
                             IsEnabled="{Binding ElementName=customSize,
                                                 Path=IsChecked}"
                             SelectedPaper="{Binding SelectedPaper,
                                                     Mode=OneWayToSource}" />
        <StackPanel Grid.Row="3"
                    HorizontalAlignment="Right"
                    Orientation="Horizontal">
            <Button Click="Button_Click" Content="{l:Loc cancel}" />
            <Button Click="Button_Click_1" Content="{l:Loc ok}">
                <Button.Style>
                    <Style BasedOn="{StaticResource ResourceKey={x:Type Button}}" TargetType="Button">
                        <Style.Triggers>
                            <MultiDataTrigger>
                                <MultiDataTrigger.Conditions>
                                    <Condition Binding="{Binding ElementName=paperPicker, Path=HasError}" Value="True" />
                                    <Condition Binding="{Binding ElementName=customSize, Path=IsChecked}" Value="True" />
                                </MultiDataTrigger.Conditions>
                                <Setter Property="IsEnabled" Value="False" />
                            </MultiDataTrigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>
            </Button>
        </StackPanel>
    </Grid>
</Window>